/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cxhd.lis.model.newmodel;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;

/**
 *
 * @author cxhd
 */
@SuppressWarnings("serial")
public class PpDeviceTest extends Model<PpDeviceTest>  {
    public static final PpDeviceTest ppDeviceTestdao=new PpDeviceTest();
   
    public void savePpDeviceTest(String DEVICEID,String TESTID,int DATA1,String TESTPK,String DEVICEPK){
        set("DEVICEID",DEVICEID)
                .set("TESTID", TESTID)
                .set("DATA1", DATA1)
                .set("TESTPK", TESTPK)
                .set("DEVICEPK", DEVICEPK)
                .save();
    }
    public void delectPpDeviceTest(String TESTID,String DEVICEID){
        Db.use("mysql").update("delete from pp_device_test where TESTID=? and DEVICEID=?",TESTID,DEVICEID);
    }
     public void delectPpDeviceTests(String DEVICEID){
        Db.use("mysql").update("delete from pp_device_test where  DEVICEID=?",DEVICEID);
    }
     
     public void updatePpDeviceTest(String PK,String TESTID,String DEVICEID,String DATA2,String DATA1,
             String UNIT,String MREFLO0,String MREFHI0,String FREFLO0,String FREFHI0,String Decimalplace,String SAMPLETYPE ){
         findById(DEVICEID,PK,TESTID).set("DATA2", DATA2)
                 .set("DATA1", DATA1)
                  .set("UNIT", UNIT)
                 .set("MREFLO0", MREFLO0)
                  .set("MREFHI0", MREFHI0)
//                  UNIT=g/mL  MREFLO0=2.1  MREFHI0=2.5  FREFLO0=2.0  FREFHI0=2.5 
//                 UNIT,       MREFLO0,     MREFHI0,     FREFLO0,     FREFHI0
                 .set("FREFLO0", FREFLO0)
                  .set("FREFHI0", FREFHI0)
                   .set("Decimalplace", Decimalplace)
                  .set("SAMPLETYPE", SAMPLETYPE)
                 .update();
     }
     public void updatTestPK(int DEVICEID,int PK,String TESTID ,int TESTPK,int DEVICEPK){
         findById(DEVICEID,PK,TESTID)
                 .set("TESTPK", TESTPK)
                 .set("DEVICEPK", DEVICEPK)
                 .update();
     }
}
